home *** CD-ROM | disk | FTP | other *** search
/ Aminet 21 / Aminet 21 (1997)(GTI - Schatztruhe)[!][Oct 1997].iso / Aminet / dev / misc / gms_dev.lha / GMS / Source / Asm / Screens / ScrollMemory.s < prev   
Encoding:
Text File  |  1997-07-09  |  2.8 KB  |  121 lines

  1. ;-------T-------T------------------------T----------------------------------;
  2. ;Name:      Scroll Memory
  3. ;Author:    Paul Manias
  4. ;Copyright: DreamWorld Productions (c) 1996-1997.  Freely distributable.
  5. ;
  6. ;This demo shows you the power of the scrolling features by allowing you
  7. ;to scroll all over your chip ram :-).  Usually you would set limits to stop
  8. ;you from going over the boundaries, but that's up to you.
  9. ;
  10. ;Use mouse to move around, LMB exits.
  11.  
  12.     INCDIR    "INCLUDES:"
  13.     INCLUDE    "games/games_lib.i"
  14.     INCLUDE    "games/games.i"
  15.  
  16.     SECTION    "Demo",CODE
  17.  
  18. ;===========================================================================;
  19. ;                             INITIALISE DEMO
  20. ;===========================================================================;
  21.  
  22.     STARTGMS
  23.  
  24. Start:    MOVEM.L    A0-A6/D1-D7,-(SP)
  25.     move.l    GMSBase(pc),a6
  26.     lea    ScreenTags(pc),a0
  27.     CALL    AddScreen
  28.     tst.l    d0
  29.     beq.s    .Error_Screen
  30.  
  31.     move.l    Screen(pc),a0
  32.     lea    PictureTags(pc),a1
  33.     move.l    GS_MemPtr1(a0),PicData
  34.     CALL    LoadPic
  35.     tst.l    d0
  36.     beq.s    .Error_Picture
  37.  
  38.     CALL    ShowScreen
  39.     CALL    InitJoyPorts
  40.     bsr.s    Main
  41.  
  42. .ReturnToDOS
  43.     move.l    GMSBase(pc),a6
  44.     move.l    Picture(pc),a1
  45.     CALL    FreePic
  46. .Error_Picture
  47.     move.l    Screen(pc),a0
  48.     CALL    DeleteScreen
  49. .Error_Screen
  50.     MOVEM.L    (SP)+,A0-A6/D1-D7
  51.     moveq    #ERR_OK,d0
  52.     rts
  53.  
  54. ;===========================================================================;
  55. ;                                MAIN LOOP
  56. ;===========================================================================;
  57.  
  58. Main:    move.l    Screen(pc),a0
  59. .loop    moveq    #JPORT1,d0
  60.     moveq    #JT_ZBXY,d1
  61.     CALL    ReadJoyPort
  62.     btst    #MB_RMB,d0
  63.     bne.s    .done
  64.     move.w    d0,d1
  65.     asr.w    #8,d0    ;d0 = X Change
  66.     ext.w    d1
  67.  
  68.     ;btst    #MB_LMB,d0
  69.     ;bne.s    .MoveScreen
  70. .MovePicture
  71.     add.w    d0,GS_PicXOffset(a0)
  72.     add.w    d1,GS_PicYOffset(a0)
  73.     CALL    RemakeScreen
  74.     CALL    MovePicture
  75.     CALL    WaitVBL
  76.     bra.s    .loop
  77.  
  78. .MoveScreen
  79.     add.w    d0,GS_ScrXOffset(a0)
  80.     add.w    d1,GS_ScrYOffset(a0)
  81.     CALL    RemakeScreen
  82.     CALL    MovePicture
  83.     CALL    WaitVBL
  84.     bra.s    .loop
  85. .done    rts
  86.  
  87. ;===========================================================================;
  88. ;                                  DATA
  89. ;===========================================================================;
  90.  
  91. ScreenTags:
  92.     dc.l    TAGS_GAMESCREEN
  93. Screen:    dc.l    0
  94.     dc.l    GSA_Palette,Palette
  95.     dc.l    GSA_ScrWidth,320
  96.     dc.l    GSA_ScrHeight,256
  97.     dc.l    GSA_AmtColours,32
  98.     dc.l    GSA_Attrib,HSCROLL|VSCROLL|SBUFFER|CENTRE
  99.     dc.l    TAGEND
  100.  
  101. Palette    dc.l    $000000,$103000,$F0C0B0,$F0A090,$D08080,$906050,$604040,$201010
  102.     dc.l    $400000,$404040,$F0F000,$403020,$C0C000,$105000,$500010,$808000
  103.     dc.l    $206010,$207010,$308020,$409020,$50A030,$50B040,$607070,$60C040
  104.     dc.l    $708080,$90A0A0,$B0C0C0,$800010,$900010,$A00020,$700010,$600010
  105.  
  106. PictureTags:
  107.     dc.l    TAGS_PICTURE
  108. Picture    dc.l    0
  109.     dc.l    PCA_Data
  110. PicData    dc.l    0
  111.     dc.l    PCA_Width,320
  112.     dc.l    PCA_Height,256
  113.     dc.l    PCA_AmtColours,32
  114.     dc.l    PCA_Palette,Palette
  115.     dc.l    PCA_File,.file
  116.     dc.l    TAGEND
  117.  
  118. .file    dc.b    "GMS:demos/data/PIC.Green",0
  119.     even
  120.  
  121.